<template>
  <view class="container">
    <web-view :src="webpageUrl" />
  </view>
</template>

<script setup>
  import {
    onLoad,
    onShow,
    onPageScroll,
    onUnload,
    onHide,
  } from '@dcloudio/uni-app'
  import { ref } from 'vue'

  const appName = import.meta.env.VITE_APP_NAME

  const webpageUrl = ref('')

  defineOptions({
    name: 'PageWebpagePage',
  })

  // 初始化
  onLoad(({ url, title }) => {
    if (!url) {
      uni.navigateBack()
      return
    }
    uni.setNavigationBarTitle({
      title: title || appName,
    })
    webpageUrl.value = decodeURIComponent(url)
  })

  // 页面显示
  onShow(() => {})

  // 页面滚动
  onPageScroll(() => {})

  // 页面卸载
  onUnload(() => {})

  // 页面隐藏
  onHide(() => {})
</script>

<style lang="scss" scoped>
  .container {
  }
</style>
